package org.jeecg.modules.equipment.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.log4j.Log4j2;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.equipment.service.FilterelementReplaceService;
import org.jeecg.modules.equipment.vo.FilterelementReplaceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: zhuzhuhong
 * @Description: 滤芯更换记录控制层
 * @Date: 2019/11/21 09:39
 */
@RestController
@RequestMapping(value = "/equipment/filterelementReplace")
@Log4j2
public class FilterelementReplaceController {

    @Autowired
    private FilterelementReplaceService filterelementReplaceService;

    @GetMapping(value = "/list")
    public Result<IPage<FilterelementReplaceVO>> getFilterelementReplaceByPage(
            @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
            @RequestParam(value = "equipmentId",required = false) String equipmentId
    ) {
        Result<IPage<FilterelementReplaceVO>> result = new Result<>();
        try {
            IPage<FilterelementReplaceVO> page = filterelementReplaceService
                    .findFilterelementReplaceVO(pageNo, pageSize,equipmentId);
            result.setResult(page);
        } catch (Exception e) {
            log.error(e.getMessage(),e);
            result.error500("后台异常");
        }

        return result;
    }


}
